package com.want.evenchat;

import android.content.Context;

import com.hyphenate.chat.EMOptions;
import com.hyphenate.easeui.controller.EaseUI;
import com.want.evenchat.model.Model;

/**
 * Created by Want on 2018/5/3.
 */

public class Application extends android.app.Application{

    private static Context mcontext;

    @Override
    public void onCreate() {
        super.onCreate();

        //初始化EaseUI
        EMOptions options = new EMOptions();
        options.setAcceptInvitationAlways(false);//接受好友邀请,设置需要同意后才能接受邀请
        options.setAutoAcceptGroupInvitation(false);//接受群邀请,设置需要同意后才能接受邀请
        EaseUI.getInstance().init(this,options);

        //初始化数据模型层类
        Model.getInstance().init(this);

        //初始化全局上下文
        mcontext = this;

    }

    //获取全局上下文对象
    public static Context getGlobalApplication(){
        return mcontext;
    }

}
